<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/template/template_dialog.xhtml">
	<ui:define name="head">
		<title>#{request.getParameter('selectName')} 定检计划分析</title>
		<link rel="stylesheet"
			href="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
.dataTable th {
	white-space: nowrap !important;
}

.box-header {
	background-color: #3c8dbc;
	color: white;
	font-family: "SimHei";
}
</style>
	</ui:define>
	<ui:define name="content">
		<div class="row">
			<div class="col-xs-12">
				<div id="d1" class="box">
					<div class="box-body">
						<div id="main" style="width: 500px; height: 300px; margin: 0 auto">
						</div>
						<table id="dateTable" class="table table-bordered table-hover">
						</table>
					</div>
				</div>
			</div>
		</div>
		<h:inputHidden id="lineName"
			value="#{request.getParameter('selectName')}"></h:inputHidden>
	</ui:define>

	<ui:define name="contentend">
	    <script src="#{request.contextPath}/resources/js/tables/mytable.js"></script>
		<script src="#{request.contextPath}/resources/js/mycharts/charts.js"></script>
		<script src="#{request.contextPath}/resources/plugins/echarts/echarts.js"></script>
		<script src="#{request.contextPath}/resources/plugins/datatables/jquery.dataTables.min.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>

		<script src="#{request.contextPath}/resources/js/array-util.js"></script>
		<script>
		
		  var namearray=['已完成','待确认','执行中','已取消','待发布','未派工','新增'];
		  var myc=new Echart3NormalRing("main");
		  var columns=['计划编号','计划类型','计划性质','工作类别','工作班组','工作地点','工作内容','工作负责人','计划状态']
		  var myopt  = MyTable.getDefaultOptions();
		  myopt.paging =  true;
		  var tab = new MyTable('dateTable',columns,myopt);
		 /*  
		  var tb = $('#dateTable').DataTable({
			     "language": {
		        	"url": "/resources/plugins/datatables/Chinese.json"
		           },
			      "paging": true,//禁止表格分页
			      "lengthChange": false,
			      "searching": true,
			      "ordering": false,
			      "info": true,
			      "autoWidth": true,	       
			       columns:[
			        {"title":"c"}, 
			        {"title":"计划类型"}, 
			        {"title":"计划性质"}, 
			        {"title":"工作类别"}, 
			        {"title":"工作班组"}, 
			        {"title":"工作地点"}, 
			        {"title":"工作内容"},
			        {"title":"工作负责人"}, 
			        {"title":"计划状态"},
			        ]
			        
		   }); */
		  
		  $(function(){
			  $.getJSON("/rest/pms/getPmsScheduledMaintenanceCount",function(result){
				    $.each(result, function(i, field){
				      for(var k=0;field.length>k;k++){
				    	  myc.addDataNameValue(namearray[k],field[k]);  			    	 
				      }	
				      myc.setLegendLabels(namearray);
				      myc.show();				     
				     			    
				    });
				  });               
		  });
		  myc.getChart().on("click",function(params){
	    	  
	    	  $.getJSON("/rest/pms/getPmsScheduledMaintenanceByStatus/"+params.name,function(result){				   				    		     		 
	    		
	    		  tab.setDataSet(result);
				  tab.show();	    		 
	    	  });	    	  
	      });
		</script>
	</ui:define>
</ui:composition>